using UnityEngine;
using UnityEngine.UI;

namespace Game.UI {
	public class MenuBar : MonoBehaviour {
		public Button ChatButton;
		public Button UnitButton;
		public Button TerminalButton;
		public Button ShipInfoButton;
		public Button CommandsButton;
		public Button HelpButton;
		public Button DebugButton;
		public Button SettingsButton;
		public Button ExitButton;

		public UIHolder UI => UIHolder.Instance;

		private void Awake() {
			ChatButton.onClick.AddListener(OnChatButtonClick);
			UnitButton.onClick.AddListener(OnUnitButtonClick);
			TerminalButton.onClick.AddListener(OnTerminalButtonClick);
			ShipInfoButton.onClick.AddListener(OnShipInfoButtonClick);
			CommandsButton.onClick.AddListener(OnCommandsButtonClick);
			HelpButton.onClick.AddListener(OnHelpButtonClick);
			DebugButton.onClick.AddListener(OnDebugButtonClick);
			SettingsButton.onClick.AddListener(OnSettingsButtonClick);
			ExitButton.onClick.AddListener(OnExitButtonClick);
		}

		void OnChatButtonClick() {
			UI.ShowWindow(WindowType.ChatWindow);
		}

		void OnUnitButtonClick() {
			UI.ShowWindow(WindowType.UnitStatusWindow);
		}

		void OnTerminalButtonClick() {
			UI.ShowWindow(WindowType.ShipConsoleWindow);
		}

		void OnShipInfoButtonClick() {
			UI.ShowWindow(WindowType.ShipInfoWindow);
		}

		void OnCommandsButtonClick() {
			UI.ShowWindow(WindowType.ShipCommandsWindow);
		}

		void OnHelpButtonClick() {
			UI.ShowWindow(WindowType.HelpWindow);
		}

		void OnDebugButtonClick() {
			UI.ShowWindow(WindowType.DebugWindow);
		}

		void OnSettingsButtonClick() {
			UI.ShowWindow(WindowType.SettingsWindow);
		}

		void OnExitButtonClick() {
			UI.ShowNoticeWindow("Quit Game", "Are you sure?", true, () => GameManager.Instance.GoToMainMenu(), ()=> { });
		}


	}
}

